﻿<Window x:Class="Fabrics.ProductsForm"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Fabrics"
        mc:Ignorable="d"
                Title="Товары" Height="450" Width="1500" MinHeight="450" MinWidth="150"  WindowStartupLocation="CenterScreen">
    <Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="80"/>
                <RowDefinition/>
                <RowDefinition Height="60"/>
            </Grid.RowDefinitions>
            <TextBlock Text="Добро пожаловать" VerticalAlignment="Top" x:Name="OpenFormTB" HorizontalAlignment="Right" Width="400"/>
            <TextBlock Text="Кол во записей" x:Name="CountInf" VerticalAlignment="Top" HorizontalAlignment="Center" FontSize="16"/>
            <TextBlock Text="Поиск" x:Name="SerchVis" Margin="10,19,0,40" HorizontalAlignment="Left" Width="290"/>
            <TextBlock Text="Цена" x:Name="CostVis" Margin="0,19,257,10" HorizontalAlignment="Right" Width="234"/>
            <TextBlock Text="Производитель" x:Name="Manuf" Margin="0,19,10,40" HorizontalAlignment="Right" Width="235"/>
            <TextBox x:Name="FindLineTxb" Grid.Row="0" Margin="10,40,500,0" VerticalAlignment="Top" VerticalContentAlignment="Center" TextChanged="FindLineTxb_TextChanged" Height="30"/>
            <ComboBox x:Name="SortProductCmb" Grid.Row="0" SelectionChanged="SortProductCmb_SelectionChanged" Margin="0,40,257,10" HorizontalAlignment="Right" Width="234">
            </ComboBox>
            <ComboBox x:Name="FilterProductCmb" Grid.Row="0" SelectionChanged="FilterProductCmb_SelectionChanged" Margin="0,40,10,10" HorizontalAlignment="Right" Width="235">
            </ComboBox>
            <ListView x:Name="ProductList" Grid.Row="1" Margin="10,0,10,0" BorderBrush="Black" BorderThickness="2" ScrollViewer.HorizontalScrollBarVisibility="Disabled">

                <ListView.ItemContainerStyle>
                    <Style TargetType="ListViewItem">
                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                    </Style>
                </ListView.ItemContainerStyle>
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="50"/>
                                <RowDefinition Height="50"/>
                                <RowDefinition Height="70"/>
                                <RowDefinition Height="50"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="150"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="450"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="335"/>
                            </Grid.ColumnDefinitions>
                            <Border BorderThickness="1" BorderBrush="Black" Grid.RowSpan="5" Grid.ColumnSpan="6"/>
                            <Image Grid.RowSpan="4" Grid.Column="1" Source="{Binding Image}" Margin="5,0,0,0"></Image>
                            <TextBlock Grid.Row="1" Text="{Binding Name}" Grid.Column="3" TextAlignment="Left" FontSize="18">
                                <TextBlock.Style>
                                    <Style TargetType="TextBlock">
                                        <Setter Property="Background" Value="Transparent"/>
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding QuantityStock}" Value="0">
                                                <Setter Property="Background" Value="Gray"/>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </TextBlock.Style>
                            </TextBlock>
                            <TextBlock Grid.Row="2" Grid.Column="3" TextAlignment="Left" FontSize="18">
                            <TextBlock Text="{Binding DescriptionProduct}"/>
                            <TextBlock>
                                    <TextBlock.Text>
                                        <MultiBinding StringFormat="{} {1}">
                                            <Binding Path="DescriptionProduct"/>
                                        </MultiBinding>
                                    </TextBlock.Text>
                            </TextBlock>
                        </TextBlock>
                            <TextBlock Grid.Row="3" Grid.Column="3" TextAlignment="Left" FontSize="18">
                                <TextBlock.Text>
                                    <MultiBinding StringFormat="{} Производитель: {0}">
                                        <Binding Path="Manufacture"/>
                                    </MultiBinding>
                                </TextBlock.Text>
                            </TextBlock>
                            <TextBlock Grid.Row="4" Grid.Column="3" TextAlignment="Left" FontSize="18">
                                <TextBlock.Text>
                                    <MultiBinding StringFormat="{} Цена: {0}">
                                        <Binding Path="Cost"/>
                                    </MultiBinding>
                                </TextBlock.Text>
                            </TextBlock>
                            <TextBlock Grid.Row="3" Grid.Column="4" TextAlignment="Left" FontSize="18">
                                <TextBlock.Text>
                                    <MultiBinding StringFormat="{} На складке: {0} шт">
                                        <Binding Path="QuantityStock"/>
                                    </MultiBinding>
                                </TextBlock.Text>
                            </TextBlock>

                        </Grid>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
            <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20" Grid.Row="1" x:Name="ResultInfo" Visibility="Hidden"/>
            <StackPanel Orientation="Horizontal" Grid.Row="2" Margin="10,0,0,0">
                <Button x:Name="AddProductBtn" Click="AddProductBtn_Click" Margin="10" Content="Добавить товар" Grid.Row="2" HorizontalAlignment="Left"/>
                <Button x:Name="RedactProductBtn" Click="RedactProductBtn_Click" Margin="10" Content="Редактировать товар" Grid.Row="2" HorizontalAlignment="Left"/>
                <Button x:Name="DeleteProductBtn" Click="DeleteProductBtn_Click" Margin="10" Content="Удалить товар" Grid.Row="2" HorizontalAlignment="Left"/>
                <Button x:Name="OutMainWindow" Click="OutMainWindow_Click" Margin="10" Content="Выход из учётной записи" Grid.Row="2" HorizontalAlignment="Left"/>
            </StackPanel>
        </Grid>
    </Grid>
</Window>
